<#include "/_inc/_layout.ftl">
<#import "/auth/_inc/_dic.ftl" as dic>
<#assign allowCreate=helper.isAuthorize("SystemRole.Create")/>
<#assign allowEdit=helper.isAuthorize("SystemRole.Edit")/>
<#assign allowDelete=helper.isAuthorize("SystemRole.Delete")/>
<#assign allowExport=helper.isAuthorize("SystemRole.Export")/>
<#assign allowMapUser=helper.isAuthorize("SystemRole.MapUser")/>
<#assign allowAuthorize=helper.isAuthorize("SystemRole.Authorize")/>
<@header/>
<div id="gridtoolbar">
    <form id="gridform" class="jxform jxlayout-form form-inline">
        <div class="form-group">
            <input name="name" class="form-control w-200px" placeholder="请输入名称/简拼关键字" autocomplete="off">
        </div>
        <div class="form-group">
            <select name="categoryId" class="form-control jxselect"
                    data-select-submit="true" data-allow-clear="false" data-width="120">
                <option value=" ">全部分类</option>
                <@dic.systemRoleCategory/>
            </select>
        </div>
        <div class="form-group">
            <select name="status" class="jxselect form-control"
                    data-select-submit="true" data-allow-clear="false" data-width="110">
                <@html.statusEnableOptions/>
            </select>
        </div>
        <button class="btn btn-primary ml-5" type="submit">
            <i class="fa fa-search"></i> 查询
        </button>
        <div class="btn-group">
	        <@html.echo test=allowCreate>
                <a id="btn-create" class="btn btn-default">
                    <i class="icon-plus"></i> 新增
                </a>
            </@html.echo>
	        <@html.echo test=allowEdit>
	            <a id="btn-edit" class="btn btn-default">
                    <i class="icon-pencil"></i> 编辑
                </a>
            </@html.echo>
	        <@html.echo test=allowDelete>
	            <a id="btn-delete" class="btn btn-default">
                    <i class="icon-trash"></i> 删除
                </a>
            </@html.echo>
	        <@html.echo test=allowExport>
	            <a id="btn-export" class="btn btn-default">
                    <i class="icon-share-alt"></i> 导出
                </a>
            </@html.echo>
        </div>
        <div class="btn-group tool-mt">
            <@html.echo test=allowMapUser>
                <a id="btn-map-user" class="btn btn-default">
                    <i class="icon-users"></i> 角色成员
                </a>
            </@html.echo>
            <@html.echo test=allowAuthorize>
                <a id="btn-authorize" class="btn btn-default">
                    <i class="fa fa-gavel"></i> 角色授权
                </a>
            </@html.echo>
        </div>
    </form>
</div>
<div id="gridcmenu">
    <@html.echo test=(allowEdit||allowDelete)>
        <ul class="dropdown-menu">
            <@html.echo test=allowEdit><li><a id="btn-cmedit"><i class="icon-pencil"></i> 编辑</a></li></@html.echo>
            <@html.echo test=allowDelete><li><a id="btn-cmdelete"><i class="icon-trash"></i> 删除</a></li></@html.echo>
        </ul>
    </@html.echo>
</div>
<table id="grid" class="jxgrid" title="<i class='jxfs'></i> 系统角色"
       data-options="form:'#gridform',toolbar:'#gridtoolbar',queryParams:{status:1}"
       data-dialog-width="40%" data-dialog-height="410px">
    <thead>
    <tr>
        <th data-options="field:'ck',checkbox:true"></th>
        <th data-options="title:'名称',field:'name',width:200,sortable: true"></th>
        <th data-options="title:'分类',field:'categoryName',width:100,align:'center',sortable: true"></th>
        <th data-options="title:'部门',field:'departmentName',width:100,align:'center',sortable: true"></th>
        <th data-options="title:'状态',field:'status',width:50,align:'center',sortable: true,formatter:jx.gf.status"></th>
        <th data-options="title:'操作人',field:'operateUserName',width:100,align:'center'"></th>
        <th data-options="title:'操作时间',field:'operateDateTime',width:170,align:'center',sortable: true"></th>
        <th data-options="title:'备注',field:'remark',width:250"></th>
    </tr>
    </thead>
</table>
<@footer>
    <script src="<@html.url '/auth/js/role.js'/>"></script>
</@footer>